package com.red.wood.module.redis.service;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import net.sf.json.JSONObject;

@Service
public class PersonPortraitService {
	
	private static final Log log = LogFactory.getLog(PersonPortraitService.class);
	
    @Autowired
    private RedisTemplate<String,String> redisTemplate;
    
    public JSONObject getPersonDetail(String msisdn) {
    	String result = redisTemplate.opsForValue().get(msisdn);
    	JSONObject datas = new JSONObject();
    	if(StringUtils.isNotBlank(result)) {
    		datas = JSONObject.fromObject(redisTemplate.opsForValue().get(msisdn));
    		datas.remove("c_timestamp");
    		datas.remove("nextuli");
    	}else {
    		log.warn("当前传入的手机号【"+msisdn+"】在缓存中不存在，请核查！");
    	}
		return datas;
    }
}
